<template>
	<view style="background-color:#f4f4f4;">
		<view style="width: 100%; height: 150px; background-color:rgba(223,22,41); ">
			<div style="margin-top: 5px; width: 80%; height: 60px;">
				<u-row>
					<u-col span="12">
					<div style="margin-top: 10px; margin-left: 10px;"><u-search placeholder="请输入拍品名称" :showAction="false" v-model="select"></u-search></div>
					</u-col>
					<div style=" margin-top: 10px;margin-left: 10px;">
					<u-col span="2"><u-icon name="list" color="#ffffff" size="28" @click="show = true">
					</u-icon>
					</u-col>
				</div>
				</u-row>
			</div>
			<u-row>
				<u-col span="3">
					<u-avatar style="width: 100px; height: 60px;"size="120rpx" :src="'http://101.43.223.224:8765/image/getImageById?id='+sellerInfo.imageId"></u-avatar>
				</u-col>
				<u-col span="5">
					<div><p style="color: #fff; font-size: 18px;">{{sellerInfo.userName}}</p></div>
					<div style=" color: #fff; font-size: 12px; margin-top: 3px;  ">粉丝：{{fenshi}}</div>
				</u-col>
				<u-col span="4">
							 <u-button  type="error" style=" width: 90px; border: ;  margin-right: 15px;"  shape="circle" :plain="true"  v-if=" show "  @click="delhome()">已关注</u-button>
					 <u-button  type="error" style=" width: 90px; border: ;  margin-right: 15px;"  shape="circle" :plain="true" v-else  @click="attention()">关注</u-button>
					 </u-col>
			</u-row>
		</view>
		 <u-tabs :list="list1" @change="tabschange" @click="click"></u-tabs>
			<view class="body" @click="toxiangqing(a.id)" style="margin-top: 15px;" v-for="a in auctionlist2" :key="a.id">
			<u-row>
				<u-col span=5  style="margin-top: -15px;">
					
				<u--image  class="image2"  radius="10" width ="120px" height="110px"  :src="'http://101.43.223.224:8765/image/getImageById?id='+a.imgId.split(',')[0]"  ></u--image>		
				</u-col>
				<u-col span=7>
					<view style=" width: 100%; height: 30px; margin-top: 10px; "><p class="p1"> {{a.goodsName}}</p></view>
					<view style=" width: 100%; height: 20px; color:  color: #afafaf;;" v-if="a.transactionStatus==1 && a.checkStatus==1"><p class="p2">距开始：<text class="bb">2</text>天<text class="bb">12</text>:<text class="bb">05</text>:<text class="bb">08</text></p></view> 
					<view style=" width: 100%; height: 20px;  color: #afafaf; margin-top: 18px;" v-if="a.transactionStatus==3"><p class="p2" >结束时间2020年12月06日 12:20</p></view> 
					<view style=" width: 100%; height: 20px;  color: #afafaf; margin-top: 18px;" v-if="a.transactionStatus==4"><p class="p2" >结束时间2020年12月06日 12:20</p></view>
					<view style=" width: 100%; height: 20px; color: #afafaf; margin-top: 18px;" v-if="a.transactionStatus==2"><p class="p2" >距结束：<text class="bb">2</text>天<text class="bb">12</text>:<text class="bb">05</text>:<text class="bb">08</text>	</p></p></view> 
					<p style="font-size: 13px;margin-top: 5px; color: #afafaf;">围观人数：8924</p>
					<view style="float: left; width: 100%; height: 30px; margin-top: 10px;"  >
						<p  style="float: left; font-size: 12px; margin-top: 5px; "  v-if="a.transactionStatus==1" >起拍价：</p>
						<p  style="float: left; font-size: 12px; margin-top: 5px;"  v-if="a.transactionStatus==2">当前价：</p>
						<p  style="float: left; font-size: 12px; margin-top: 5px;"  v-if="a.transactionStatus==3">成交价：</p>
						<p  style="float: left; color: red; font-size: 20px;">￥{{a.startPrice}}</p>
						
						<u-button v-if="a.checkStatus==2"  @click="tiaozhuan(a.id)" :customStyle="{}"> 设置拍卖信息</u-button>
						</view>
				</u-col>			
			</u-row>
			
			 </view><strong></strong>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				show: true,
				fenshi:0,
				sellerId:1,
				goodsName:"",
				auctionlist2:[],
				sellerInfo:{},
				sellerGoods:{},
				userId:'',
				uId:'',
				id:'',
				auctionlist:[{
					id: '',
					goodsName:'', //拍卖名称
					startPrice:'',//起拍价钱
					imgId:'', //图片id
					transactionStatus:"", //拍卖状态
					startTime:'', //拍卖时间
				}],
				
				src:'/static/12348.jpg',
				list1: [	{
						  name: '全部',
							},
							{
							name: '待开拍'
				            }, 
							{
				            name: '竞价中'
				            },
							{
				             name: '拍卖结束'
				              }]
			}
		},
		mounted () {
		  this.auctionwivi() //订单单查
		  this.uidlist()
		},
		    onLoad: function(option){
				var userId = uni.getStorageSync("loginId")
				if(userId){
				this.userId = userId
				}
				var that = this
	// 获取上一页面传输过来的参数
				this.uId = option.id
			 console.log("aaa"+this.uId)
			 
			 
			 uni.request({
			     url:'http://'+that.$host+':'+that.$port+'/clientuser/clientUserId?id='+that.uId,
			     success(res4) {
			         that.sellerInfo = res4.data.obj
			         console.log(res4)
			     }
			 })
			 
			 // uni.request({
			 //     url:'http://'+that.$host+':'+that.$port+'/client/auction/getGoodsByUserIdLimit6?userId='+that.uId,
			 //     success(res3) {
			 //         that.sellerGoods = res3.data.obj
			 //     }
			 // })
			 
			},
		
		methods: {
            toxiangqing(id){
                uni.navigateTo({
                    url:'/pages/paiMaiXiangQing/paiMaiXiangQing?id='+id
                })
            },
			  open() {
			        // console.log('open');
			      },
				 close() {
					  this.show = false
					  // console.log('close');
					},
			personal(){
				uni.navigateTo({
					url:'/pages/mine/indetail/indetail'
				})
			},
			delhome(){
				 var that = this
					uni.request({
						url: "http://"+that.$host+":"+that.$port+"/clientInterest/clientDel",
						data: {userId:that.userId, uuId:that.uId},
						method: 'GET',
						dataType: 'json',
                        success(res) {
                            that.show = false
                        }
					})
			},
			uidlist(){
				 var that = this
				uni.request({
						url: "http://"+that.$host+":"+that.$port+"/clientInterest/clientFen", 
							data : {
							uuId:that.uId
							},
						method: 'GET',
						dataType: 'json',
						success: (res) => {
						that.fenshi =  res.data.obj
						if(res.data.obj){
							that.show=true
						}else{
							that.show=false
						}
						}
						})
			},
			attention(){
				 var that = this
				 var user = {
					 userId: that.userId,
					 uuId: parseInt(this.uId)
				 }
				uni.request({
						url: "http://"+that.$host+":"+that.$port+"/clientInterest/clientIntegerAdd",         
						method: 'POST',
						data: JSON.stringify(user),
						dataType: 'json',
                        success() {
                            that.show=true
                        }
						});
			},
			auctionwivi(a){
                var that = this
				uni.request({
						url: "http://"+that.$host+":"+that.$port+"/listBysellerId/listBysellerId", 
							data:{
							sellerId:this.uId,
							goodsName:this.goodsName,
							},
						method: 'GET',
						dataType: 'json',
						success: (res) => {
						this.auctionlist = res.data.obj
						this.auctionlist2 = res.data.obj
						console.log(this.auctionlist.lenght)
							},                  	
						});
			},
			tabschange(e){
				if(e.index == 0){
					this.auctionlist = this.auctionlist2
				}else if(e.index==1){
					this.auctionlist = this.auctionlist2.filter(a => {return a.transactionStatus==1})
				}else if(e.index == 2){
					this.auctionlist = this.auctionlist2.filter(a => {return a.transactionStatus==2})
				}else if(e.index == 3){
					this.auctionlist = this.auctionlist2.filter(a => {return a.transactionStatus==3})
				}
			},
			daifuk(index){
				uni.navigateTo({
					url:'/pages/mine/order/order?index=' +index
				})
			},
			
			collect(){
				uni.navigateTo({
					url:'/pages/mine/collect/collect'
				})
			},	
			site(){
				uni.navigateTo({
					url:'/pages/mine/site/site'
				})
			},
			orders(){
				uni.navigateTo({
					url:'/pages/mine/order/order'
				})
			},
			wallet(){
				uni.navigateTo({
					url:'/pages/mine/wallet/wallet'
				})
			},
			paryict(){
				uni.navigateTo({
					url:'/pages/mine/participation/participation'
				})
			},
			auction(){
				uni.navigateTo({
					url:'/pages/mine/auction/auction'
				})
			}
		}
	}
</script>

<style>
.image1{
	margin-left: 5px;

}
.image2{
	margin-top: 27px;
	margin-left: 5px;
	/* float: left; */
}
.p1{
	font-size: 16px;
	font-weight: 500;
}
.p2{
		font-size: 12px;
}

.bb{
    color:#afafaf;
    
    border-radius: 5px 5px 5px 5px;
}
.body{
	width: 95%;
	height: 140px;
	margin-top: 10px;
	background-color: #fff;

	margin: 0 auto;
	border-radius:15px;
}
</style>
